package com.linchaoen.elema.controller;

import com.linchaoen.elema.model.entity.Label;
import com.linchaoen.elema.model.entity.StoreLabel;
import com.linchaoen.elema.service.LabelService;
import com.linchaoen.elema.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/v1/pub/label")
public class LabelController {

    @Autowired
    private LabelService labelService;

    @GetMapping("get_food_by_label")
    public JsonData getFoodByLabel(@RequestParam(value = "store_id") Integer storeId) {
        List<Label> labelList = labelService.queryLabelBySid(storeId);
        return JsonData.buildSuccess(labelList);
    }

    @GetMapping("get_store_by_label")
    public JsonData getStoreByLabel() {
        List<StoreLabel> labelList = labelService.getStoreByLabel();
        return JsonData.buildSuccess(labelList);
    }


}
